package com.sunny.design.decorator.normal;

/**
 * 通过装饰者模式可以很方便的对类进行扩展，相同功能可以复用，直接在原基础上扩展，无需新增类
 *
 * @author Sunny
 * @date 2020/1/12 下午4:19
 */
public class NormalDecoratorTest {

    public static void main(String[] args) {
        BatterCake batterCake = new BaseBatterCake();
        System.out.println(batterCake.getMsg() + ", 总价：" + batterCake.getPrice());

        batterCake = new EggDecorator(batterCake);
        System.out.println(batterCake.getMsg() + ", 总价：" + batterCake.getPrice());

        batterCake = new EggDecorator(batterCake);
        System.out.println(batterCake.getMsg() + ", 总价：" + batterCake.getPrice());

        batterCake = new HotDogDecorator(batterCake);
        System.out.println(batterCake.getMsg() + ", 总价：" + batterCake.getPrice());
    }
}
